package org.cuatrovientos.EMPIRE_FLEET;

import java.util.Scanner;
import java.util.Vector;

/**
 * Represents an imperial Fleet composed
 * of many space_ships
 * @author Sienar Fleet Systems
 * @greets the emperor
 */
public class Fleet extends Vector<SpaceShip> {
	
	private static final long serialVersionUID = 1L;
	private String nameComander;
	
	/**
	 * @return the nameComander
	 */
	String getNameComander() {
		return nameComander;
	}

	/**
	 * @param nameComander the nameComander to set
	 */
	 void setNameComander(String nameComander) {
		this.nameComander = nameComander;
	}

	/**
	 * creates Fleet
	 */
	public void create_fleet () {
		Scanner reader = new Scanner(System.in);
		newNameCommander(reader);
	}
	/**
	 * creates Commander
	 * @param reader
	 */
	private void newNameCommander(Scanner reader){
	
		do {
			System.out.println("Identify yourself");
			setNameComander(reader.nextLine());
		} while (getNameComander().isEmpty());
	}
		// We start a loop to define the Fleet
		// In each loop commander chooses one kind of ship to be added
		// to his Fleet
	public void setFleet(int type,String pilot) {
        
        
        switch (type) {
                case 1: // a tie fighter
                                this.add(new TieFighter(pilot,type));
                                break;
                case 2:
                                this.add(new TieAdvanced(pilot,type));
                                break;
                case 3:
                                this.add(new TieBomber(pilot,type));
                                break;
                default:
                
        }
	}
        
		
		//shows complete Fleet info
	public void string() {
           for (SpaceShip ship : this) {
                    System.out.println("Type: " + ship.getType() + "," + ship.toString());
            }
    
	}
}
	
